export const registClassFun = (Element) => {
  Element.registerFunction('addClass', function (classList) {
    var self = this;
    BI.each(classList.split(' '), (i, cls) => {
      if (cls && !self.classMap[cls]) {
        self.classList.push(cls);
      }
      cls && (self.classMap[cls] = true);
    });
    return this;
  });

  Element.registerFunction('removeClass', function (classList) {
    var self = this;
    BI.each(classList.split(' '), (i, cls) => {
      if (cls && self.classMap[cls]) {
        delete self.classMap[cls];
        self.classList.splice(self.classList.indexOf(cls), 1);
      }
    });
    return this;
  });
};
